package com.yangguang.huahui.ui.adapters;

import com.yangguang.huahui.R;
import com.yangguang.huahui.baseadapter.BaseQuickAdapter;
import com.yangguang.huahui.baseadapter.BaseViewHolder;
import com.yangguang.huahui.entity.ClientNeeds;
import com.yangguang.huahui.utils.CommonUtil;

import java.util.Calendar;
import java.util.List;

/**
 * Created by Administrator on 2017/3/6.
 */

public class ClientNeedsAdapter extends BaseQuickAdapter<ClientNeeds.ListBean>{

    public ClientNeedsAdapter(int layoutResId, List<ClientNeeds.ListBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, ClientNeeds.ListBean item) {
        helper.setText(R.id.tv_name, item.getGoods_title());
        helper.setText(R.id.tv_price, item.getPrice());
        helper.setText(R.id.tv_source, item.getSource_of_supply_name());
        if (!CommonUtil.isNull(item.getDeadline())) {
            helper.setText(R.id.tv_date, "采购截止日期：" + CommonUtil.longToTime(Long.parseLong(item.getDeadline()+"000"), Calendar.DATE));
        }else {
            helper.setText(R.id.tv_date, "采购截止日期：");
        }
    }
}
